package com.wedjg.concurrency.example.singleton;

import com.wedjg.concurrency.annotations.NotThreadSafe;

/**
 * 懒汉式单例
 * 安全发布对象
 * @author wedjg
 * @version 1.0
 * @date 2019/6/2
 */
@NotThreadSafe
public class SingletonExample1 {

    private static SingletonExample1 instance = null;

    private SingletonExample1() {
    }

    public static SingletonExample1 getInstance() {
        if (instance == null) {
            instance = new SingletonExample1();
        }
        return instance;
    }
}
